<%--
  Created by IntelliJ IDEA.
  User: 10452
  Date: 2022/3/23
  Time: 20:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title></title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="/welcome/Css/bootstrap.css" />
    <link rel="stylesheet" type="text/css" href="/welcome/Css/bootstrap-responsive.css" />
    <link rel="stylesheet" type="text/css" href="/welcome/Css/style.css" />
    <script type="text/javascript" src="/welcome/Js/jquery.js"></script>
    <script type="text/javascript" src="/welcome/Js/jquery.sorted.js"></script>
    <script type="text/javascript" src="/welcome/Js/bootstrap.js"></script>
    <script type="text/javascript" src="/welcome/Js/ckform.js"></script>
    <script type="text/javascript" src="/welcome/Js/common.js"></script>



    <style type="text/css">
        body {
            padding-bottom: 40px;
        }
        .sidebar-nav {
            padding: 9px 0;
        }

        @media (max-width: 980px) {
            /* Enable use of floated navbar text */
            .navbar-text.pull-right {
                float: none;
                padding-left: 5px;
                padding-right: 5px;
            }
        }


    </style>
</head>
<body>
<form action="index.html" method="post" class="definewidth m20" id="ResEditForm">
    <input type="hidden" name="id" value="{$user.id}" />
    <table class="table table-bordered table-hover definewidth m10">
        <tr>
            <td width="10%" class="tableleft">资源名称</td>
            <td><input type="text" name="m_name" value="${menu.m_name}"/></td>
        </tr>
        <tr>
            <td class="tableleft">url</td>
            <td><input type="text" name="m_url" value="${menu.m_url}" disabled/></td>
        </tr>
        <tr>
            <td class="tableleft">是否有效</td>
            <td>
                <input type="radio" name="m_state" value="0" checked/> 有效
                <input type="radio" name="m_state" value="1" /> 无效
            </td>
        </tr>
        <tr>
            <td class="tableleft"></td>
            <td>
                <button type="button" class="btn btn-primary" type="button" id="update">更新</button>&nbsp;&nbsp;<button type="button" class="btn btn-success" name="backid" id="backid">返回列表</button>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
<script>
    $(function () {
        let m_id = ${menu.m_id};
        $("#update").click(function () {
            $.ajax({
                type: "POST",
                url: "/resource/"+m_id,
                data: $("#ResEditForm").serialize()+"&_method=PUT",
                dataType:"json",
                success: function(vo){
                    if (vo.code == 200){
                        alert(vo.msg)
                    }else {
                        alert(vo.msg)
                    }
                }
            })
        })
        $('#backid').click(function(){
            window.location.href="index.jsp";
        });
    });
</script>